package wsz.edu.remote;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import wsz.edu.dto.PromotionAdDTO;
import wsz.edu.dto.PromotionSpaceDTO;
import wsz.edu.response.ResponseDTO;

import java.util.List;

/**
 * 服务调用，指向impl服务
 * @author wsz
 * @date 2022/4/25 13:34
 **/
@FeignClient(name = "edu-ad-boot", path = "/ad")
public interface AdRemoteService {

    /**
     * 获取所有
     * @return
     */
    @GetMapping("/space/getAllSpaces")
    List<PromotionSpaceDTO> getAllSpaces();

    /**
     * 根据类别获取
     * @param spaceKey
     * @return
     */
    @GetMapping("/space/getAdBySpaceKey")
    List<PromotionSpaceDTO> getAdBySpaceKey(@RequestParam("spaceKey") String[] spaceKey);

    /**
     * 新增或修改
     * @param spaceDTO
     * @return
     */
    @PostMapping("/space/saveOrUpdateSpace")
    ResponseDTO saveOrUpdateSpace(@RequestBody PromotionSpaceDTO spaceDTO);

    /**
     * id获取
     * @param id
     * @return
     */
    @GetMapping("/getSpaceById")
    ResponseDTO getSpaceById(@RequestParam("id") Integer id);

    @GetMapping("/getAllAds")
    ResponseDTO getAllAds();

    @PostMapping("/saveOrUpdateAd")
    ResponseDTO saveOrUpdateAd(@RequestBody PromotionAdDTO adDTO);

    @GetMapping("/getAdById")
    ResponseDTO getAdById(@RequestParam("id") Integer id);
}
